package main

import (
	"fmt"
)

type People interface {
	GetName() string
}

type Student struct {
	name string
}

func (s *Student) GetName() string {
	return s.name
}

type Teacher struct {
	name string
}

func (t *Teacher) GetName() string {
	return t.name
}

func GetName(p People) {
	fmt.Println(p.GetName())
}

func main() {
	s := &Student{"Tom"}
	t := &Teacher{"Jack"}
	GetName(s)
	GetName(t)
	// 输出： Tom Jack
	fmt.Println("===================")
	more := []People{&Student{name: "go"}, &Teacher{name: "java"}}
	for _, v := range more {
		fmt.Println(v.GetName())
	}
	fmt.Println("===================")
	// 如何判断s是不是Student类型？
}
